﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel;


namespace SetListManager.Models
{	
    
    /// <summary>
    /// The Song class encapsulates a song and its attributes in the system.
    /// </summary>
    public class Song
    {

        //Store the usage list for the edit view    
       // public System.Web.Mvc.SelectList UsageList;

        // **************************
        // ***** PRIMARY FIELDS *****
        // **************************

       
        /// <summary>
        /// The ID used as the primary key
        /// </summary>
        public int SongID { get; set; }

        /// <summary>
        /// The Band associated with this song
        /// </summary>
        public Band Band { get; set; }
        public int BandID { get; set; }

        /// <summary>
        /// Title of the song.  Required attribute.
        /// </summary>
        [Required(ErrorMessage = "Title must be specified")]
        [StringLength(255)]
        [DisplayName("Title")]
        public string Title { get; set; }

        /// <summary>
        /// Key of the song (Cm, A, F#, etc.).  Optional.
        /// </summary>
        [StringLength(15)]
        [DisplayName("Key")]
        public string Key { get; set; }

        /// <summary>
        /// The soloist singer who sings this song. Optional.
        /// </summary>
        [StringLength(25)]
        [DisplayName("Soloist")]
        public string Soloist { get; set; }

        /// <summary>
        /// Song tempo, mostly used for the drummer. Optional.
        /// </summary>
        [StringLength(15)]
        [DisplayName("Tempo")]
        public string Tempo { get; set; }

        /// <summary>
        /// Song genre, for example "Blues", "Christmas", "Pop".  Optional.
        /// </summary>
        [StringLength(15)]
        [DisplayName("Genre")]
        public string Genre { get; set; }

        /// <summary>
        /// Song duration in minutes and seconds.  Required.
        /// </summary>
        ///         
        [DisplayName("Song Duration")] // NOTE: Changed display name to "Song Duration" so it doesn't get confused with set list duration
        public MinSec Duration { get; set; }


        /// <summary>
        /// Song usage - is this a current song, an old one we no longer perform, etc.
        /// </summary>
        [DisplayName("Song Usage")]
        public UsageType Usage { get; set; }

        /// <summary>
        /// Optional song note. Freeform text.
        /// </summary>
        /// 
        /// NOTE: We removed the singluar "Note" field and made it into Note1.. Note5 below
        /// 
        //  [DataType(DataType.MultilineText)]
        //  [DisplayName("Internal Note")]
        //  public string Note { get; set; }

        // **********************
        // ***** SONG NOTES *****
        // **********************
        // Each song can have up to 5 notes associated with it.  The actual meaning of these 
        // notes is kept in the "Band" table, since it is settable on a band-by-band basis.
        public string Note1 { get; set; }
        public string Note2 { get; set; }
        public string Note3 { get; set; }
        public string Note4 { get; set; }
        public string Note5 { get; set; }


        // ***********************
        // ***** SONG GROUPS *****
        // ***********************

        /// <summary>
        /// Group ID. If set, this is the identifier for the song group.  If NULL, the song
        /// is not in a group.
        /// </summary>
        public SongGroup Group { get; set; }
        public int SongGroupID { get; set; }

        /// <summary>
        /// The ordering of this song within the group
        /// </summary>
        public int GroupOrder { get; set; }

    }

    /// <summary>
    /// The SongAndUsageModel class is a composite of the Song and UsageType entities. 
    /// This is used when a view will need to display data from both on the same page.
    /// </summary>
    public class SongAndUsageTypes
    {
        public Song song { get; set; }
        public IQueryable<UsageType> usagetypes { get; set; }
        public string duration_str { get; set; } // Hack: pass duration as string, so we can parse it in code
    }

    public class SongAndUsageTypes2
    {
        public Song song { get; set; }
        public IQueryable<UsageType> usagetypes { get; set; }
        public string duration_str { get; set; } // Hack: pass duration as string, so we can parse it in code
    }
}

